<template>
  <div>
    <h1>新闻</h1>
    <hr />
    <router-link to="/newview/1">新闻1</router-link><br>
     <router-link to="/newview/2">新闻2</router-link><br>
     <router-link to="/newview/3">新闻3</router-link><br>
     <router-link to="/newview/4">新闻4</router-link><br>
     <router-link to="/newview/5">新闻5</router-link>
    <!-- 二级路由占位符 -->
    <div class="container">
      <router-link class="link" tag="div" to="/news/junshi"
        >军事新闻</router-link
      >
      <router-link class="link" tag="div" to="/news/yule">娱乐新闻</router-link>
    </div>

    <router-view></router-view>
  </div>
</template>

<script>
export default {
  data() {
    return {};
  },
  created() {
    // console.log(this.$route.query);
  },
  methods: {},
  components: {},
  // 离开组件
  beforeRouteLeave(to, from, next) {
    // ...
    console.log("离开新闻组件");
    next();
  },
};
</script>
<style scoped>
</style>